# CMake 2.8.12.1 or greater required for CUDA 5.5 support
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12.1)
PROJECT(liboz)

SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )

SET( CMAKE_CONFIGURATION_TYPES "Release;Debug" CACHE STRING "limited configs" FORCE )
IF( NOT CMAKE_BUILD_TYPE )
    SET( CMAKE_BUILD_TYPE Debug CACHE STRING "" FORCE)
ENDIF()

SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

INCLUDE(3rdparty)
INCLUDE(Utils)
INCLUDE(SetupCPack)
INCLUDE(SetupCUDA)

# try to find Qt5
SET(USE_QT5 OFF)
FIND_PACKAGE(Qt5Widgets QUIET)
IF(Qt5Widgets_FOUND)
    SET(USE_QT5 ON)
ENDIF()

IF(USE_QT5)
    #SET(CMAKE_AUTOMOC ON)
    FIND_PACKAGE(Qt5 COMPONENTS Core Gui OpenGL PrintSupport REQUIRED)
    # wrap include and library directories
    SET(QT_INCLUDES ${Qt5Core_INCLUDE_DIRS} ${Qt5OpenGL_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5PrintSupport_INCLUDE_DIRS})
    SET(QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Gui_LIBRARIES} ${Qt5PrintSupport_LIBRARIES})
else(USE_QT5)
    FIND_PACKAGE(Qt4)
    INCLUDE(${QT_USE_FILE})
ENDIF()

FIND_PACKAGE(OpenCV QUIET)
FIND_PACKAGE(TIFF QUIET)
FIND_PACKAGE(Libav QUIET)
#FIND_PACKAGE(OpenGL)
#FIND_PACKAGE(GLEW)
FIND_PACKAGE(Cairo QUIET)
#FIND_PACKAGE(Matlab QUIET)

ADD_SUBDIRECTORY(oz)
ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(main)
ADD_SUBDIRECTORY(test)
OPTION(PYTHON_OZ_MODULE "Build python extension module" OFF)
IF(PYTHON_OZ_MODULE)
    ADD_SUBDIRECTORY(pyoz)
ENDIF()
